package Chat;

import javax.swing.*;
import java.awt.*;

public class Client {
    public static void main(String[] args) {
        new Client().init();
    }

    private JTextArea chat = new JTextArea(13,30);
    private JScrollPane scrollPane = new JScrollPane();
    private JTextField sendtext = new JTextField();
    private JButton button1 = new JButton("发送");
    private JButton button2 = new JButton("关闭");

    public void init() {
        JFrame frame = new JFrame();

        //底部的发送信息
        JPanel btpanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
        btpanel.add(button1);
        btpanel.add(button2);

        //中间的聊天信息
        Box abbox = Box.createVerticalBox();
        abbox.add(chat);
        abbox.add(sendtext);

        frame.add(btpanel, BorderLayout.SOUTH);
        frame.add(abbox, BorderLayout.CENTER);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.pack();
        frame.setSize(650, 500);
        frame.setVisible(true);
    }
}
